
var tDate = require("../../../utils/date.js");
const util = require("../../../utils/util.js");

const app = getApp()

var that;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    // 机器ID
    materialID: "",
    taskItem: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    that = this;
    that.setData({
      materialID: options.materialID
    })
    this.refreshNewData();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  //刷新数据
  refreshNewData: function () {
    //加载提示框
    util.showLoading();
    var urlStr = '/api/task/filter/' + that.data.materialID;
    var parameters = "";
    console.log("parameters = " + parameters);
    util.request(urlStr, parameters, function (res) {
      util.hideToast();
      console.log("+++++请求成功");
      console.log("data===" + res.data);
      // var materialIDStr = res.data.data.machine;

      // var filterBuildArrayStr = res.data.data.partsList;
      // var historyFilterBuildArrayStr = res.data.data.partsHisList;

      that.setData({
        taskItem: res.data.data
      });
    })
  }
})